﻿using System;
using System.Net;
using System.Runtime.Serialization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Yek.BI.Data
{
    [DataContract]
    public class BIData
    {
        [DataMember(Name = "version")]
        public string Version { get; set; }

        [DataMember(Name = "keepID")]
        public KeepID KeepID { get; set; }

        [DataMember(Name = "userDefID")]
        public UserDefID UserDefID { get; set; }

        [DataMember(Name = "types")]
        public Type[] Types { get; set; }

        [DataMember(Name = "events")]
        public Event[] Events { get; set; }
        private string hFile;
        public string HFile
        {
            get
            {
                if (hFile == null)
                    Create();
                return hFile;
            }
            set
            {
                hFile = value;
            }
        }
        private void Create()
        {
            System.Text.StringBuilder h = new System.Text.StringBuilder();
            h.Append("// 所有事件模型类的头文件，使用者包含此文件即可\r\n");
            foreach (var e in this.Events)
            {
                h.Append(string.Format("#import \"{0}.h\"\r\n", e.FileName));
            }
            hFile = h.ToString();
        }
    }
}
